From ded6ab53aec40f05317ac8e355f38334d01ba5d0 Mon Sep 17 00:00:00 2001 From: John Audia Date: Sat, 15 Mar 2025 07:19:41 -0400 Subject: [PATCH] nvme-cli: update to 2.11 MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Bump to latest upstream release. Removed upstreamed: 020-replace_uint16_t Manually rebased: 010-gcc14.patch To fix the following build error, added two commits from upstream: 020-nvme-print-add-fallback-for-.patch 021-pligins-netapp-add-include-of-libgen.h-for-basename.patch Tested the resulting binary and it seems fine: % nvme smart-log /dev/nvme0 | grep "temperature" temperature : 42 °C (315 K) Link to upstream issue: https://github.com/linux-nvme/nvme-cli/issues/2743 Build error: ../nvme-print.c: In function 'is_temperature_fahrenheit': ../nvme-print.c:805:19: error: 'LC_MEASUREMENT' undeclared (first use in this function) 805 | setlocale(LC_MEASUREMENT, ""); | ^~~~~~~~~~~~~~ ../nvme-print.c:805:19: note: each undeclared identifier is reported only once for each function it appears in Build system: x86/64 Build-tested: x86/64 Run-tested: x86/64 Signed-off-by: John Audia --- utils/nvme-cli/Makefile | 4 +-- utils/nvme-cli/patches/010-gcc14.patch | 17 ---------- .../020-nvme-print-add-fallback-for-.patch | 31 +++++++++++++++++++ utils/nvme-cli/patches/020-replace_uint16_t | 28 ----------------- ...add-include-of-libgen.h-for-basename.patch | 26 ++++++++++++++++ 5 files changed, 59 insertions(+), 47 deletions(-) create mode 100644 utils/nvme-cli/patches/020-nvme-print-add-fallback-for-.patch delete mode 100644 utils/nvme-cli/patches/020-replace_uint16_t create mode 100644 utils/nvme-cli/patches/021-pligins-netapp-add-include-of-libgen.h-for-basename.patch diff --git a/utils/nvme-cli/Makefile b/utils/nvme-cli/Makefile index 7502943b13..90ad3983f3 100644 --- a/utils/nvme-cli/Makefile +++ b/utils/nvme-cli/Makefile @@ -5,12 +5,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=nvme-cli -PKG_VERSION:=2.9.1 +PKG_VERSION:=2.11 PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=https://github.com/linux-nvme/nvme-cli/archive/refs/tags/v$(PKG_VERSION) -PKG_HASH:=4b61684a1d23de1d9d0abd3f273799c60256c0e2a2e68a790d7945183fe33874 +PKG_HASH:=5e4dc73dbb488c6b1e6ad1c78d0c62b624076fcb0c052bd9039674a1dbd6517b PKG_LICENSE:=GPL-2.0-or-later PKG_LICENSE_FILES:=LICENSE diff --git a/utils/nvme-cli/patches/010-gcc14.patch b/utils/nvme-cli/patches/010-gcc14.patch index 63bc2415e3..5badc8b073 100644 --- a/utils/nvme-cli/patches/010-gcc14.patch +++ b/utils/nvme-cli/patches/010-gcc14.patch @@ -1,22 +1,5 @@ --- a/plugins/virtium/virtium-nvme.c +++ b/plugins/virtium/virtium-nvme.c -@@ -32,14 +32,14 @@ static char vt_default_log_file_name[256 - struct vtview_log_header { - char path[256]; - char test_name[256]; -- long time_stamp; -+ time_t time_stamp; - struct nvme_id_ctrl raw_ctrl; - struct nvme_firmware_slot raw_fw; - }; - - struct vtview_smart_log_entry { - char path[256]; -- long time_stamp; -+ time_t time_stamp; - struct nvme_id_ns raw_ns; - struct nvme_id_ctrl raw_ctrl; - struct nvme_smart_log raw_smart; @@ -127,7 +127,7 @@ static void vt_convert_smart_data_to_hum capacity = le64_to_cpu(smart->raw_ns.nsze) * lba; diff --git a/utils/nvme-cli/patches/020-nvme-print-add-fallback-for-.patch b/utils/nvme-cli/patches/020-nvme-print-add-fallback-for-.patch new file mode 100644 index 0000000000..50df4945d9 --- /dev/null +++ b/utils/nvme-cli/patches/020-nvme-print-add-fallback-for-.patch @@ -0,0 +1,31 @@ +From 9444ce03a27b8d423f8170cf75f56d48d8a0a659 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Daniel=20N=C3=A9ri?= +Date: Mon, 11 Nov 2024 23:06:03 +0100 +Subject: [PATCH] nvme-print: add fallback for non-standard locale category +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +LC_MEASUREMENT is a GNU (libc) extension - fall back to LC_ALL if it's +not defined. + +Fixes build with musl libc + +Signed-off-by: Daniel Néri +--- + nvme-print.c | 4 ++++ + 1 file changed, 4 insertions(+) + +--- a/nvme-print.c ++++ b/nvme-print.c +@@ -797,6 +797,10 @@ static bool is_fahrenheit_country(const + return false; + } + ++#ifndef LC_MEASUREMENT ++#define LC_MEASUREMENT LC_ALL ++#endif ++ + static bool is_temperature_fahrenheit(void) + { + const char *locale, *underscore; diff --git a/utils/nvme-cli/patches/020-replace_uint16_t b/utils/nvme-cli/patches/020-replace_uint16_t deleted file mode 100644 index 0e247f0670..0000000000 --- a/utils/nvme-cli/patches/020-replace_uint16_t +++ /dev/null @@ -1,28 +0,0 @@ -From 650070ad5d4a97fc87f9018743e3b566deba36c8 Mon Sep 17 00:00:00 2001 -From: Khem Raj -Date: Tue, 21 May 2024 14:09:32 -0700 -Subject: [PATCH] plugins/ssstc: Replace __uint16_t with uint16_t - -uint16_t is ISO defined and comes from stdint.h, makes it -portable across glibc and musl on linux. - -Signed-off-by: Khem Raj ---- - plugins/ssstc/ssstc-nvme.c | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) - ---- a/plugins/ssstc/ssstc-nvme.c -+++ b/plugins/ssstc/ssstc-nvme.c -@@ -64,9 +64,9 @@ void show_ssstc_add_smart_log_jsn(struct - unsigned int nsid, const char *devname) - { - struct json_object *root, *entry_stats, *dev_stats, *multi; -- __uint16_t wear_level_min = 0; -- __uint16_t wear_level_max = 0; -- __uint16_t wear_level_avg = 0; -+ uint16_t wear_level_min = 0; -+ uint16_t wear_level_max = 0; -+ uint16_t wear_level_avg = 0; - uint64_t raw_val = 0; - - root = json_create_object(); diff --git a/utils/nvme-cli/patches/021-pligins-netapp-add-include-of-libgen.h-for-basename.patch b/utils/nvme-cli/patches/021-pligins-netapp-add-include-of-libgen.h-for-basename.patch new file mode 100644 index 0000000000..016cdbcb17 --- /dev/null +++ b/utils/nvme-cli/patches/021-pligins-netapp-add-include-of-libgen.h-for-basename.patch @@ -0,0 +1,26 @@ +From ac4818952c872ba465a2d0f48634f9a79aae064f Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Daniel=20N=C3=A9ri?= +Date: Mon, 11 Nov 2024 22:34:57 +0100 +Subject: [PATCH] plugins/netapp: add include of libgen.h for basename(3) + prototype +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Fixes build with musl libc. + +Signed-off-by: Daniel Néri +--- + plugins/netapp/netapp-nvme.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/plugins/netapp/netapp-nvme.c ++++ b/plugins/netapp/netapp-nvme.c +@@ -22,6 +22,7 @@ + #include + #include + #include ++#include + + #include "common.h" + #include "nvme.h" -- 2.30.2